package cn.fastoo.common.dao.product;
import cn.fastoo.common.entity.product.Product;
import cn.fastoo.common.entity.product.ProductAttrValue;
import cn.fastoo.common.entity.product.ProductSku;
import cn.fastoo.common.sampleframe.dao.FastDao;
import cn.fastoo.common.sampleframe.dao.impl.FastDaoImpl;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

import javax.sql.DataSource;
import java.util.Date;


@Component
@Transactional
public class ProductSkuDao extends FastDaoImpl<ProductSku> implements FastDao<ProductSku> {


    @Autowired
    @Qualifier("mainDS")
    private void setJt(DataSource ds){
        this.jt = new JdbcTemplate(ds);
    }

    public Logger logger = LoggerFactory.getLogger(ProductSkuDao.class);


    public void deleteByProductId(Long id) {
        jt.update(" delete from product_sku where product_id = ?",id);
    }
}
